@extends('admin.layout')
@section('content')
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                Data Tables
                <small>advanced tables</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
                <li><a href="#">Tables</a></li>
                <li class="active">Data tables</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                    <div class="box">
                        <div class="box-header">
                            <h3 class="box-title">Hover Data Table</h3>
                        </div><!-- /.box-header -->
                        <div class="box-body">

                        @if(session('info'))
                        <div class="callout callout-success">
                            <p>{{session('info')}}</p>
                        </div>
                        @endif

                            <form action="{{ url('/admin/order/index') }}">
                                <div class="row">
                                    <div class="col-sm-8">
                                        <div class="dataTables_length" id="example1_length"><label>显示 <select name="num" aria-controls="example1" class="form-control input-sm">
                                            <option 
                                            @if(!empty($request['num']) && $request['num'] == 10) selected="selected"
                                            @endif
                                             value="10">10</option>
                                            <option @if(!empty($request['num']) && $request['num'] == 25) selected="selected"@endif
                                            value="25">25</option>
                                            <option @if(!empty($request['num']) && $request['num'] == 50) selected="selected" @endif
                                            value="50">50</option>
                                            <option @if(!empty($request['num']) && $request['num'] == 100) selected="selected" @endif
                                            value="100">100</option>
                                        </select> 条</label>
                                        </div>
                                    </div>
                                    <div class="col-sm-4">
                                        <div class="input-group input-group-sm">
                                            <input value="{{ $request['keyword'] or '' }}" name="keyword" class="form-control" type="text">
                                            <span class="input-group-btn">
                                              <button class="btn btn-info btn-flat" type="submit">搜索</button>
                                            </span>
                                        </div>
                                    </div>
                                </div>
                            </form>
                            <table id="example2" class="table table-bordered table-hover">
                                <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>订单号</th>
                                    <th>用户名</th>
                                    <th>会员类别</th>
                                    <th>应付金额</th>
                                    <th>支付状态</th>
                                    <th>下单时间</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr>
                                @foreach($data as $k => $v)
                                    <td>{{ $v -> id }}</td>
                                    <td>{{ $v -> num }}</td>
                                    <td>{{ $userName[$k] -> name }}</td>
                                    <td class="cname">{{ $v -> goods }}</td>
                                    <td>{{ $v -> account }}</td>
                                    <td>
                                    @if($v -> access == 1)
                                        已支付
                                    @else
                                        未支付
                                    @endif
                                    </td>
                                    <td>{{ $v -> time }}</td>
                                    <td>
                                        <a href="{{ url('/admin/order/suredel') }}/{{ $v -> id }}"> 彻底删除</a>&nbsp;&nbsp;
                                        <a href="{{ url('/admin/order/unsuredel') }}/{{ $v -> id }}"> 恢复</a>
                                    </td>
                                </tr>
                                @endforeach
                                </tbody>

                            </table>
                            {{ $data -> appends($request) -> links() }}
                        </div><!-- /.box-body -->
                    </div><!-- /.box -->
                </div><!-- /.col -->
            </div><!-- /.row -->
        </section><!-- /.content -->
</div><!-- /.content-wrapper -->
@endsection
